package com.yunfeisoft.business.model;

import com.yunfeisoft.common.base.BaseModel;
import com.yunfeisoft.common.sql.record.TransientField;
import com.yunfeisoft.common.utils.DateUtils;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * ClassName: ReceiveApply
 * Description: 接待申请单
 *
 * @Author: Jackie liu
 * Date: 2020-01-09
 */
@Entity
@Table(name = "TT_RECEIVE_APPLY")
public class ReceiveApply extends BaseModel implements Serializable {

    /**
     * Field serialVersionUID: 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 流程定义id
     */
    @Column
    private String workflowDefineId;

    /**
     * 负责人
     */
    @Column
    private String chargeUser;

    /**
     * 接待时间
     */
    @Column
    private Date receiveTime;

    /**
     * 接待对象
     */
    @Column
    private String target;

    /**
     * 行程安排
     */
    @Column
    private String schedule;

    /**
     * 接待要求
     */
    @Column
    private String require;

    /**
     * 类别
     */
    @Column
    private Integer category;

    /**
     * 接待费用
     */
    @Column
    private BigDecimal cost;

    /**
     * 费用归属
     */
    @Column
    private String costOwner;

    @TransientField
    private String createName;
    //下一节点处理人
    private String nextStepUserId;

    public String getReceiveTimeStr() {
        return DateUtils.dateToString(receiveTime, "yyyy-MM-dd HH:mm");
    }

    public String getCategoryStr() {
        return ReceiveApplyCategoryEnum.valueOf(category);
    }

    public String getWorkflowDefineId() {
        return workflowDefineId;
    }

    public void setWorkflowDefineId(String workflowDefineId) {
        this.workflowDefineId = workflowDefineId;
    }

    public String getChargeUser() {
        return chargeUser;
    }

    public void setChargeUser(String chargeUser) {
        this.chargeUser = chargeUser;
    }

    public Date getReceiveTime() {
        return receiveTime;
    }

    public void setReceiveTime(Date receiveTime) {
        this.receiveTime = receiveTime;
    }

    public String getSchedule() {
        return schedule;
    }

    public void setSchedule(String schedule) {
        this.schedule = schedule;
    }

    public String getRequire() {
        return require;
    }

    public void setRequire(String require) {
        this.require = require;
    }

    public Integer getCategory() {
        return category;
    }

    public void setCategory(Integer category) {
        this.category = category;
    }

    public BigDecimal getCost() {
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public String getCostOwner() {
        return costOwner;
    }

    public void setCostOwner(String costOwner) {
        this.costOwner = costOwner;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public String getNextStepUserId() {
        return nextStepUserId;
    }

    public void setNextStepUserId(String nextStepUserId) {
        this.nextStepUserId = nextStepUserId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public enum ReceiveApplyCategoryEnum {

        A(1, "A类（会务类）"),
        B(2, "B类（参考观察类）"),
        C(3, "C类（公务接待）"),
        D(4, "D类（重要贵宾）"),
        E(5, "E类（大型活动）");

        private int value;
        private String label;

        private ReceiveApplyCategoryEnum(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public static String valueOf(Integer value) {
            if (value == null) {
                return null;
            }
            for (ReceiveApplyCategoryEnum loop : ReceiveApplyCategoryEnum.values()) {
                if (value == loop.getValue()) {
                    return loop.getLabel();
                }
            }
            return null;
        }

        public int getValue() {
            return value;
        }

        public String getLabel() {
            return label;
        }
    }
}